<template>
  <div>
    <h1>请选择你喜欢的登录页面</h1>
    <el-carousel :interval="4000" type="card" height="300px" v-if="showLoginPageSelector">
      <el-carousel-item @click="selectLoginPage">
        <router-link to="/login/login1" class="noUnderline">
          <img :src="loginImage1" alt="登录页1" />
        </router-link>
      </el-carousel-item>
      <el-carousel-item @click="selectLoginPage">
        <router-link to="/login/login2" class="noUnderline">
          <img :src="loginImage2" alt="登录页2" />
        </router-link>
      </el-carousel-item>
      <el-carousel-item @click="selectLoginPage">
        <router-link to="/" class="noUnderline">
          <div class="container">
            <h2 class="no-login-message">我不需要登录，直接进入</h2>
          </div>
        </router-link>
      </el-carousel-item>
    </el-carousel>
    <router-view />
  </div>
</template>

<script>
export default {
  name: 'Login',
  data() {
    return {
      showLoginPageSelector: true,
      loginImage1: require('@/assets/image/login1.png'),
      loginImage2: require('@/assets/image/login2.png'),
    };
  },
  methods: {
    selectLoginPage() {
      this.showLoginPageSelector = false;
    },
  },
};
</script>

<style lang="scss" scoped>
// 防止样式错乱
.box {
  background: none;
}

img {
  width: 80%;
}

.container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0px auto;
  height: 100%;
}

// 轮播图
.el-carousel__item .medium {
  color: #475669;
  font-size: 14px;
  opacity: 0.75;
  line-height: 200px;
  margin: 0;
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n + 1) {
  background-color: #d3dce6;
}
</style>
